<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form>
        <!-- input textarea seletct button -->
        <h2>form1</h2>
        <p>
            name <input type="text" name="username">
        </p>
        <p>
            email <input type="text" name="email">
        </p>
        <p>
            <button>提交</button>
        </p>
    </form>
    <script>
        console.log(document.forms);
        console.log(document.forms[0].elements);
        console.log(document.forms[0].elements.username);
        console.log(document.forms[0].elements.email);
    </script>
</body>

</html>